package com.Oct_Night;

import java.util.ArrayList;
import java.util.List;

public class Solution08_04 {

    List<List<Integer>> list=new ArrayList<>();
    List<Integer> path=new ArrayList<>();

    public List<List<Integer>> subsets(int[] nums) {
        dfs(nums,0);
        return list;
    }

    void dfs(int[] nums,int startIndex){
        list.add(new ArrayList<>(path));
        for (int i=startIndex;i<nums.length;i++)
        {
            path.add(nums[i]);
            dfs(nums,i+1);
            path.remove(path.size()-1);
        }
    }

    public static void main(String[] args) {
        Solution08_04 solution08_04=new Solution08_04();
        System.out.println(solution08_04.subsets(new int[]{1,2,3}));
    }
}
